<template>
    <div class="container">
        <error-tip :errorCode="errorCode" v-if="errorCode"></error-tip>
        <div v-else>
            <month-card-list :data="monthData"></month-card-list>
        </div>
    </div>
</template>

<script>
// 导入vuex中的store
import { useStore } from 'vuex'
// 导入生命周期函数
import { computed,onMounted } from 'vue'
// 导入api请求函数
import getData from '@/services'
// 导入获取当前日期的函数
import { getNowDate } from '@/libs/utils'
// 导入组件
import MonthCardList from '@/components/MonthPage/List.vue'


export default {
    // 生命周期函数
    setup() {
        const store = useStore()

        onMounted(() => { // 页面加载完成后执行的函数
            const field = store.state.field
            getData(store, field, getNowDate(field))
        })

        return {
            monthData: computed(() => store.state.monthData),
            errorCode: computed(() => store.state.errorCode)
        }
    },
    components: {
        MonthCardList
    }
}
</script>

<style lang="less" scoped>
    
</style>